package org.tourism.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.tourism.VO.ComplaintHandlingVO;
import org.tourism.entity.ComplaintHandling;
import org.tourism.mapper.ComplaintHandlingMapper;
import org.tourism.service.ComplaintHandlingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ComplaintHandlingServiceImpl extends ServiceImpl<ComplaintHandlingMapper, ComplaintHandling> implements ComplaintHandlingService {
    @Autowired
    private ComplaintHandlingMapper complaintHandlingMapper;

    @Override
    public int addComplaintHandling(ComplaintHandlingVO complaintHandlingVO) {
        ComplaintHandling complaintHandling = complaintHandlingVO.toEntity();
        return complaintHandlingMapper.insert(complaintHandling);
    }

    @Override
    public int updateComplaintHandling(ComplaintHandling complaintHandling) {
        return complaintHandlingMapper.updateById(complaintHandling);
    }

    @Override
    public int deleteComplaintHandlingByComplaintId(Integer complaintId) {
        return complaintHandlingMapper.deleteById(complaintId);
    }

    @Override
    public List<ComplaintHandling> getAllComplaintHandling() {
        return complaintHandlingMapper.selectList(null);
    }

    @Override
    public ComplaintHandling getComplaintHandlingById(Integer complaintHandlingId) {
        return complaintHandlingMapper.selectById(complaintHandlingId);
    }


}
